package com.nytd.demo.component;

import com.nytd.demo.model.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class BeanConfig {
//    @Primary
    @Bean("u1")
    public User user1(){
        User user = new User();
        user.setName("张三");
        user.setAge(18);
        return user;
    }
    @Bean(name = {"u2", "user2"})
    public User user2(){
        User user = new User();
        user.setName("李四");
        user.setAge(20);
        return user;
    }
}
